import request from '@/utils/request';

/**
 * 商品列表
 * @param query 
 * @returns 
 */
export const listPage = (query) => {
  return request({
    url: '/seller/goods/list',
    method: 'get',
    params: query
  });
};

/**
 * 商品详情
 * @param query 
 * @returns 
 */
export const info = (query) => {
  return request({
    url: '/seller/goods/detail',
    method: 'get',
    params: {
      id: query.id
    }
  });
};

// 新增
export const add = (query) => {
  return request({
    url: `/seller/goods/add`,
    method: 'post',
    data: query
  });
};

// 编辑
export const edit = (query) => {
  return request({
    url: `/seller/goods/edit`,
    method: 'post',
    data: query
  });
};

// 启用禁用
export const changeStatusApi = (query) => {
  return request({
    url: `/seller/goods/enable/${query.id}`,
    method: 'post',
  });
};

// 推荐 取消推荐
export const changeRecommendApi = (query) => {
  return request({
    url: `/seller/goods/recommend/${query.id}`,
    method: 'post',
  });
};

// 删除
export const del = (query) => {
  return request({
    url: `/seller/goods/remove/${query.id}`,
    method: 'post',
  });
};